import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Image;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

import pl.edu.szlif.mosm.commonlib.MathSupplement;
import pl.edu.szlif.mosm.commonlib.provider.OSMTilesProvider;
import pl.edu.szlif.mosm.commonlib.provider.TilesProvider.TilesProviderListener;

public class testMIDlet extends MIDlet implements TilesProviderListener {

	protected void destroyApp(boolean unconditional)
			throws MIDletStateChangeException {

	}

	protected void pauseApp() {

	}

	protected void startApp() throws MIDletStateChangeException {
		System.out.println(MathSupplement.pow2(1));
		System.out.println(MathSupplement.pow2(2));
		System.out.println(MathSupplement.pow2(3));
		
		OSMTilesProvider provider = new OSMTilesProvider(new J2MEGenericHttpConnectionImpl());
		provider.requestTile(2047, 1362, 12, this);
	}

	public void tileNotAvailable(int tx, int ty, int zoom) {
		System.out.println("Error");
		
	}

	public void tileReady(int tx, int ty, int zoom, Image tile) {
		System.out.println("Success");
		Display disp = Display.getDisplay(this);
		Form scr = new Form("Test screen");
		scr.append(tile);
		disp.setCurrent(scr);
	}
	
	
}
